<?php 
      if(isset($_POST["body"]))
      {
        $title = $_POST["title"];
        $body = $_POST["body"]; 
        $body = nl2br($body);
        $tags = $_POST["tags"];        
        $poster = $_POST["poster"];
        $date = date("d-M-Y @ H:i",time());
        
        $error = 0;
        if($title == '')
        {
            trace("You forgot to add a title please go back and do it again");
            $error = 1;  
        } 
        
        if($body == '')
        {
            trace("You forgot to add content please go back and do it again");
            $error = 1;    
        }
        
        if($error)
            exit();
        
        $title = $parser->qParse($title);
        $body = $parser->qParse($body);
        
        if(mysql_query("INSERT INTO news SET title = '$title', body = '$body', tags = '$tags', poster = '$poster', date = '$date'"))
        {
            trace("News entered");   
        }
        else
        {
            trace("Error entering news");
            trace(mysql_error());   
        }
        exit();   
      }
?>
<form method="post" class="news">
    <input type="text" name="title" id="title" class="req" value="" display="Title"/>
    <br />
    <textarea name="body" cols="20" rows="10" id="body" class="req" display="Content"></textarea>
    <br />
    <input type="text" name="tags"/>
    <br />
    <input type="submit" value="Submit" id="submitBtn" class="news"/>
</form>
